package cn.huiyunche.base.service.interfaces.impl;

import cn.huiyunche.base.service.interfaces.CDriverCertinfoService;
import cn.huiyunche.base.service.mappers.CDriverCertinfoMapper;
import cn.huiyunche.base.service.model.CDriverCertinfo;
import cn.huiyunche.base.service.model.CDriverCertinfoExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by jxy on 16/12/12.
 */
@Service
public class CDriverCertinfoServiceImpl implements CDriverCertinfoService {

    @Autowired
    private CDriverCertinfoMapper cDriverCertinfoMapper;

    /**
     * 校验身份证号是否存在
     *
     * @param idNo 身份证号
     * @return 如果存在返回true 不存在返回false
     */
    public boolean validIdNoExist(String idNo) {
        CDriverCertinfoExample cDriverCertinfoExample = new CDriverCertinfoExample();
        cDriverCertinfoExample.createCriteria().andIdnoEqualTo(idNo);
        List<CDriverCertinfo> list = cDriverCertinfoMapper.selectByExample(cDriverCertinfoExample);

        if (list != null && list.size() > 0) {
            return true;
        } else {
            return false;
        }
    }
}
